-
Notifications
You must be signed in to change notification settings - Fork 598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(sink): impl RowEncoder for JsonEncoder #12264
Conversation
Codecov Report
@@ Coverage Diff @@
## main #12264 +/- ##
==========================================
+ Coverage 69.71% 69.73% +0.01%
==========================================
Files 1411 1413 +2
Lines 236351 236390 +39
==========================================
+ Hits 164783 164835 +52
+ Misses 71568 71555 -13
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 8 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
} | ||
} | ||
|
||
fn datum_to_json_object( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All lines below (i.e. datum_to_json_object
and mod tests
) are moved from sink::utils
without changing a single character.
|
||
fn encode( | ||
&self, | ||
row: RowRef<'_>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
row: impl Row
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impl Row
seems not enough here. It needs to be either &impl Row
or impl Row + Copy
. Each style appears exactly twice in existing code base. Do we have a preference here?
Some thoughts:
impl Row + Copy
can be specified in caller, but&impl Row
must be hereimpl Row + Copy
accepts non-ref but&impl Row
does notimpl Row + Copy
is a superset of&impl Row
thanks toimpl<R: Row> Row for &R
src/connector/src/sink/utils.rs
Outdated
@@ -405,26 +258,24 @@ pub async fn gen_upsert_message_stream<'a>( | |||
pk_indices: &'a [usize], | |||
chunk: StreamChunk, | |||
_opts: UpsertAdapterOpts, | |||
key_encoder: JsonEncoder, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May pass impl RowEncoder
instead of JsonEncoder
to make the code more general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is included in later part of the refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM.
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Part A of #12125 targeting #11995:
RowEncoder
,SerTo<String>
,SerTo<Vec<u8>>
.JsonEncoder
as an implementation ofRowEncoder
pk_to_json
andrecord_to_json
insink::utils
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.